package net.love5z.web.dao;

import net.love5z.web.dao.dto.UserDto;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

public interface UserMapper {

    @Select({ "select", " id, email, password_hash, password_salt, create_time, modify_time",
            " from love5z_user", "where email = #{email}", "limit 0, 1" })
    @Results({
            @Result(column = "id", property = "id", jdbcType = JdbcType.BIGINT, id = true),
            @Result(column = "email", property = "email", jdbcType = JdbcType.VARCHAR),
            @Result(column = "password_hash", property = "passwordHash", jdbcType = JdbcType.VARCHAR),
            @Result(column = "password_salt", property = "passwordSalt", jdbcType = JdbcType.VARCHAR),
            @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP) })
    UserDto getUserByEmail(@Param("email")
    String email);

}
